/*
 * @Descripttion: 
 * @Author: 银河以北
 * @Date: 2023-05-26 23:39:27
 * @LastEditors: 银河以北
 * @LastEditTime: 2024-08-28 23:07:12
 */

// 获取主题文件名
export function themeList() {

    // 读取文件
    const files = import.meta.glob("/public/style/highlight/*.css");

    let fileList = []

    for (let item in files) {
        // 从路径中获取文件名
        const fileName = item.replace(/(.*\/)*([^.]+).*/ig, "$2")
        fileList.push(fileName)
    }

    return fileList
}


// 获取可设置语言
export function languageList() {
    const files = import.meta.glob("../../node_modules/highlight.js/lib/languages/*.js");

    let fileList = []

    for (let item in files) {

        // 从路径中获取文件名
        const fileName = item.replace(/(.*\/)*([^.]+).*/ig, "$2")

        fileList.push(fileName)

    }

    // 数组去重
    fileList = Array.from(new Set(fileList))

    return fileList
}